<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
        </script>
        <style type="text/css">
            .img {
                width: 20px;
                height: 30px;
            }
        </style>
    </ui:define>
    <ui:define name="content">
        <div style="margin:20px;">
            <h:form id="form">
                <p:growl id="msgs" showDetail="false"/>
                <p:panel id="ppCondition" header="成分计量数量结算比较" style="width: 100%">
                    <h:panelGrid columns="2" cellspacing="3" style="width: 100%">
                        <h:panelGrid id="pgCondition">
                            <h:panelGrid columns="4">
                                <h:outputLabel value="成本计划：" for="cstplPkid" style="font-weight: bold"/>
                                <p:selectOneMenu id="cstplPkid"
                                                 value="#{itemHieRelapCMeaSubStlQForQueryAction.strCstplPkid}">
                                    <f:selectItems value="#{itemHieRelapCMeaSubStlQForQueryAction.cstplList}"/>
                                </p:selectOneMenu>
                                <h:outputLabel value="期数编码：" for="periodNo" style="font-weight: bold"/>
                                <p:inputText id="periodNo" value="#{itemHieRelapCMeaSubStlQForQueryAction.strPeriodNo}"
                                             onclick="WdatePicker({dateFmt:'yyyyMM'})"/>
                            </h:panelGrid>
                        </h:panelGrid>
                        <h:panelGrid columns="2" style="width:100%">
                            <p:commandButton id="qryBtn" value="查询"
                                             action="#{itemHieRelapCMeaSubStlQForQueryAction.onQueryAction()}"
                                             style="width:90px"
                                             update="pdt,msgs,pgCondition">
                            </p:commandButton>
                            <p:commandButton id="resetBtn" value="重置"
                                             action="#{itemHieRelapCMeaSubStlQForQueryAction.reSetAction()}"
                                             style="width:90px"
                                             update="ppCondition,msgs">
                            </p:commandButton>
                        </h:panelGrid>
                    </h:panelGrid>
                </p:panel>

                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="/images/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value=""/>
                    </f:facet>
                </p:ajaxStatus>

                <p:dataTable id="pdt" style="width:100%;"
                             value="#{itemHieRelapCMeaSubStlQForQueryAction.itemOfCSStlQForQueryList}"
                             var="record"
                             rowKey="#{record.strCstpl_Pkid}"
                             selectionMode="single"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                             {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true"
                             paginatorPosition="bottom"
                             rows="100"
                             rowsPerPageTemplate="200,100,50,40,30,20,10"
                             rowIndexVar="row"
                             emptyMessage="数据记录为空..."
                             stickyHeader="#{itemHieRelapCMeaSubStlQForQueryAction.strStickyHeaderFlag}">

                    <p:columnGroup type="header">
                        <p:row>
                            <p:column headerText="序号" rowspan="2" style="width:30px"/>
                            <p:column headerText="成本计划" colspan="4"/>
                            <p:column headerText="统计计量" colspan="2"/>
                            <p:column headerText="分包合同" colspan="2"/>
                            <p:column headerText="分包结算" colspan="2"/>
                            <p:column headerText="统计计量与分包结算比较" colspan="3"/>
                        </p:row>

                        <p:row>
                            <p:column headerText="编号"/>
                            <p:column headerText="项目名称"/>
                            <p:column headerText="单位"/>
                            <p:column headerText="单价"/>

                            <p:column headerText="工程量"/>
                            <p:column headerText="合计"/>

                            <p:column headerText="分包单位"/>
                            <p:column headerText="单价"/>

                            <p:column headerText="工程量"/>
                            <p:column headerText="合计"/>

                            <p:column headerText="工程量"/>
                            <p:column headerText="单价"/>
                            <p:column headerText="合计"/>
                        </p:row>
                    </p:columnGroup>

                    <p:column style="width:30px">
                        <h:outputText value="#{row + 1}"/>
                    </p:column>

                    <p:column style="width:100px">
                        <h:outputText value="#{record.strCstpl_No}" escape="false"/>
                    </p:column>
                    <p:column style="width:150px">
                        <h:outputText value="#{record.strCstpl_Name}"/>
                    </p:column>
                    <p:column style="width:40px">
                        <h:outputText value="#{record.strCstpl_Unit}"/>
                    </p:column>
                    <p:column style="width:60px">
                        <h:outputText value="#{record.bdCstpl_ContractUnitPrice}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column style="width:80px">
                        <h:outputText value="#{record.bdTkcttStl_MeaQuantity}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column style="width:80px">
                        <h:outputText value="#{record.bdTkcttStl_MeaAmount}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column style="width:250px">
                        <h:outputText value="#{record.strSubctt_SignPartName}" style="text-align:left">
                        </h:outputText>
                    </p:column>
                    <p:column style="width:60px">
                        <h:outputText value="#{record.bdSubctt_ContractUnitPrice}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column style="width:80px">
                        <h:outputText value="#{record.bdSubcttStl_BeginToCurrentPeriodQQty}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column style="width:100px">
                        <h:outputText value="#{record.bdSubcttStl_BeginToCurrentPeriodMAmount}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column style="width:100px">
                        <h:outputText value="#{record.bdMeaS_BeginToCurrentPeriodQQty}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column style="width:60px">
                        <h:outputText value="#{record.bdMeaS_ContractUnitPrice}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column style="width:100px">
                        <h:outputText value="#{record.bdMeaS_BeginToCurrentPeriodMAmount}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <f:facet name="footer">
                        <div style="text-align: left">
                            <p:commandButton value="导出到EXCEL"
                                             action="#{itemHieRelapCMeaSubStlQForQueryAction.onExportExcel}"
                                             ajax="false"
                                             rendered="#{itemHieRelapCMeaSubStlQForQueryAction.strExportToExcelRendered}">
                            </p:commandButton>
                        </div>
                    </f:facet>
                </p:dataTable>
            </h:form>
        </div>
    </ui:define>

</ui:composition>